home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / protect-your-privacy / p.g.p. / pgpamiga / pgp-installer-script < prev    next >
Text File  |  1996-02-26  |  27KB  |  824 lines

  1. ; PGP Installer script
  2. ; $VER: PGP-Installer 0.8 for 2.6ui (26.10.94)
  3.  
  4. ; ***********************************************************
  5. ; * Basic PGP v2.6ui Installation
  6. ; *
  7. ; * Installs PGP, support files, and AmigaGuide documentation
  8. ; *
  9. ; * by Jacob Ellis <jellis@nah.oau.org>
  10. ; *
  11. ; *
  12. ; * Tries to be smart about where files should go, especially
  13. ; * if upgrading from a previous version of PGP.
  14. ; *
  15. ; * I have tried my best to work around some of the limitations
  16. ; * of Installer, which while powerful in some ways, it is extremely
  17. ; * limited in others (very annoying!!!). Hopefully you'll think
  18. ; * the results are worthwhile.
  19. ; *
  20. ; *
  21. ; * Note: Unlike many Installer scripts, the novice install
  22. ; *       is truly fully automatic (as per the Installer
  23. ; *       manual). Don't panic though, it'll make good guesses on
  24. ; *       where things should go (IMHO). And, as you might expect,
  25. ; *       expert install truly does require you to confirm
  26. ; *       EVERY action.
  27. ; *
  28. ; ***********************************************************
  29. ; *
  30. ; * Limitations:
  31. ; *
  32. ; *     Required OS 2.04 or better (this isn't a limitation
  33. ; *     in my opinion!). This is simply because I was too
  34. ; *     lazy to ask the 1.3 user where they keep ENVARC: (and what
  35. ; *     a hassle if they don't have an ENVARC:!)
  36. ; *
  37. ; *     Only supports English (but does install the PGP
  38. ; *     extra language files). Support is in for other languages,
  39. ; *     but this will require someone to translate the text
  40. ; *     messages (I have to say I am very disappointed on how
  41. ; *     well Installer supports other languages).
  42. ; *
  43. ; *    Does not currently install any extras. Installer does
  44. ; *     not support lists (as far as I can tell), which means
  45. ; *     each filename must be specified (unless, of course,
  46. ; *     you just wanted to copy whole directories) individually
  47. ; *     each time you want to do something with it.
  48. ; *
  49. ; *     Will only install PGP v2.6ui reliably, this script
  50. ; *     should abort on any other version of PGP. Expert user
  51. ; *     can override this.
  52. ; *
  53. ; *    The method used to determine if an older version of PGP
  54. ; *     is being installed is very weak (ie. file date), but
  55. ; *     better than nothing.
  56. ; *
  57. ; ***********************************************************
  58. ; *
  59. ; * General Program Outline:
  60. ; *
  61. ; * Note: Novice users are not asked anything. Defaults for them
  62. ; *       are set to the logic outlined below.
  63. ; *
  64. ; *     1. Check if ENV:PGP exists.
  65. ; *         A) Yes, get ENV:PGPPATH for directions.
  66. ; *                Check path for directions to PGP binary.
  67. ; *        B) No, looks like a new install. Use default settings.
  68. ; *
  69. ; *     2. Ask user where PGP and support should be installed.
  70. ; *         A) Look if PGP might exist there.
  71. ; *             i)  Yes, assume an upgrade, use current settings.
  72. ; *             ii) No, assume new install.
  73. ; *
  74. ; *     3. Check if AmigaGuide is installed.
  75. ; *         A) Yes, find most logical place for AmigaGuide files.
  76. ; *                     i)  ENV:AmigaGuide/Path
  77. ; *                     ii) Check OS versions
  78. ; *                 a) => OS 2.1 then HELP:@language
  79. ; *                 b) < OS 2.1 then S:
  80. ; *               iii) Ask for user override
  81. ; *             B) No, copy AmigaGuide documentation with support files.
  82. ; *
  83. ; *     4. Check if PGP to install is older than PGP already installed.
  84. ; *             A) Yes, ask if user wants to abort.
  85. ; *             B) No, continue install.
  86. ; *
  87. ; *     5. Upgrading from a previous version?
  88. ; *             A) Yes, ask if user wants new configuration.
  89. ; *                     i) Yes, install new configuration.
  90. ; *                    ii) Yes, backup old configuration, then install new.
  91. ; *             B) No, keep old configuration.
  92. ; *
  93. ; *     6. Install files to selected destinations.
  94. ; *
  95. ; *     7. New installation?
  96. ; *             A) Yes, set ENV: and ENVARC: to match installed settings.
  97. ; *             B) No, leave ENV: and ENVARC: alone.
  98. ; *
  99. ; *     8. View readme
  100. ; *             A) OS => 3.0 then use Multiview
  101. ; *             B) OS < 3.0 then use More
  102. ; *
  103. ; *
  104. ; ***********************************************************
  105. ; *
  106. ; * History
  107. ; *
  108. ; * 0.1    Initial version (24.2.94)
  109. ; *
  110. ; * 0.2 Minor cleanup (25.2.94)
  111. ; *          + Accidently left some old debug code in
  112. ; *
  113. ; * 0.3 Minor fix for OS 2.04 users (26.2.94)
  114. ; *          + Novice OS 2.04 users that added AmigaGuide and
  115. ; *        did not bother to specify a location for
  116. ; *             AmigaGuide files would end up with their
  117. ; *        PGP AmigaGuide files in HELP:(language).
  118. ; *        This now defaults to S: (same as AmigaGuide) if
  119. ; *             no other more logical location can be found.
  120. ; *           + Added history section
  121. ; *           + Added more comments to obscure sections
  122. ; *           + Fixed prompt and help messages for AmigaGuide
  123. ; *             installation.
  124. ; *           + Added % complete indicators
  125. ; *
  126. ; * 0.4 Minor fix for ENV: and ENVARC: paths (28.2.94)
  127. ; *           + ENV: and ENVARC: variables are now forced to use
  128. ; *             absolute paths. Previously, a relative path could
  129. ; *        be specified.
  130. ; *
  131. ; * 0.5 Minor change to account for upgrading users (1.3.94)
  132. ; *     Major change to account for workbench users
  133. ; *           + Discovered major problem with the script if run
  134. ; *        from Workbench. Workbench only gives the
  135. ; *        Installer the default system path, this consists
  136. ; *        of Current_dir and C:. This is not acceptable,
  137. ; *        so the script is now an IconX script that calls
  138. ; *             Installer. This seems to have solved the problem,
  139. ; *             but I wish there was a neater way to do this. :(
  140. ; *           + A user who upgrades from a previous version of PGP
  141. ; *             and wishes to install PGP in a new location could
  142. ; *             cause PGP to get confused about what it should do
  143. ; *             with the old configuration file. PGP-Install now
  144. ; *             treats a user in this class as a completely new install,
  145. ; *             rather than as an upgrade (so they get a new Config
  146. ; *             file in the new location and their old Config is not
  147. ; *             touched).
  148. ; *          + Added program outline for those curious about PGP-Install's
  149. ; *             logic and reasoning. This is really to explain why
  150. ; *        PGP-Install chooses where things go, and to help
  151. ; *             you identify what went wrong if PGP-Install should
  152. ; *        break on your configuration.
  153. ; *
  154. ; * 0.6 Major fix for AmigaGuide path finding logic (2.3.94)
  155. ; *     Major change for PGP revision finding code
  156. ; *           + If your ENV:AmigaGuide/Path variable contains
  157. ; *             multiple paths or leading spaces (shame on you),
  158. ; *             PGP-Install can now extract a readable path from
  159. ; *             that variable.
  160. ; *           + Installer has trouble understanding PGP's version
  161. ; *             string, so the method for determining an out of date
  162. ; *             version of PGP is changed. It is now based on file date
  163. ; *             and size. Obviously, this could have a lot of problems,
  164. ; *             but it's better than nothing. :)
  165. ; *
  166. ; * 0.7 Major change for PGP integrity check (30.5.94)
  167. ; *           + The check now does MD5SUM checking instead of the
  168. ; *             older Installer getsum() method. The entire archive
  169. ; *             is now checked in less than the time it took to check
  170. ; *             just the PGP binary with the old method.
  171. ; *           + Updated files for PGP Amiga 2.3a.3
  172. ; *
  173. ; * 0.8 Major change for PGP installation for PGP Amiga 2.6ui
  174. ; *           + Updated files for PGP Amiga 2.6ui
  175. ; *           + Added advanced processor checking
  176. ; *           + Added better handling of some PGP options
  177. ; *
  178. ; ***********************************************************
  179.  
  180.  
  181.  
  182. ; ***********************************************************
  183. ; * Set APPNAME if started directly from shell
  184. ; * Note: this is broken!
  185. ; ***********************************************************
  186.  
  187. (set @app-name "PGP 2.6ui")
  188.  
  189. (set osver (/ (getversion) 65536)) ; get OS version
  190.  
  191. (if (>= (database "cpu") 68020)
  192.     (set advancedcpu TRUE)
  193.     (set advancedcpu FALSE)
  194. )
  195.  
  196.  
  197. ; ***********************************************************
  198. ; * Important file names and stuff to be installed
  199. ; * This applies ONLY to 2.6ui
  200. ; ***********************************************************
  201.  
  202. (set newpgpbin000 "bin/PGP")
  203. (set newpgpbinsum000 1812306934)
  204. (set newpgpbinsize000 145792)
  205.  
  206. (set newpgpbin020 "bin/PGP020")
  207. (set newpgpbinsum020 2060478590)
  208. (set newpgpbinsize020 144444)
  209.  
  210. ; Unforunately, Installer does not seem to be able to deal with
  211. ; lists. So each file must be listed individually (yuck!).
  212.  
  213. ; Files used by PGP installation
  214.  
  215. ; bin/PGP
  216. ; bin/PGP020
  217.  
  218. ; bin/#?.hlp
  219.  
  220. ; bin/Config.txt
  221. ; bin/language.txt
  222. ; bin/keys.asc
  223.  
  224. ; doc/PGPNutshell.guide
  225. ; doc/PGPDoc1.guide
  226. ; doc/PGPDoc2.guide
  227.  
  228. ; contrib/md5sum/md5sum
  229.  
  230. ; Readme.Amiga
  231.  
  232. ; ***********************************************************
  233. ; * PGP Config file
  234. ; ***********************************************************
  235.  
  236. (set pgpconfig "Config.txt")
  237. (set newpgpconfig (tackon "bin" pgpconfig))
  238.  
  239.  
  240.  
  241. ; ***********************************************************
  242. ; * Check to make sure English is the language used here
  243. ; * Other languages will hopefully be supported in the future
  244. ; ***********************************************************
  245.  
  246. (if(= @language "english")
  247.  
  248.     ; Set up strings for English usage
  249.         (
  250.      (set #yes "Yes")
  251.      (set #no "No")
  252.  
  253.      (set #already-installed (cat
  254.                 @app-name " appears to already be installed.\n"
  255.         "Do you wish to install anyway?")
  256.      )
  257.      (set #already-installed-help (cat
  258.                 @app-name " appears to already be installed.")
  259.      )
  260.      (set #already-installed-abort (cat
  261.         @app-name " already installed.\nAborting install.")
  262.      )
  263.  
  264.      (set #old-installed (cat
  265.                 "You seem to be attempting to install an older"
  266.         " version of PGP. Installation of an older"
  267.         " version of PGP is not recommended. Do you wish"
  268.         " to continue?")
  269.      )
  270.      (set #old-installed-help (cat
  271.         @app-name " may not be the latest version of PGP. "
  272.         " You are strongly adviced to examine this archive"
  273.         " and your currently installed version of PGP"
  274.         " more closely.")
  275.      )
  276.      (set #old-installed-abort (cat
  277.         @app-name " may be out of date. Please check your"
  278.         " currently installed version of PGP and examine "
  279.         " the PGP included in this archive more closely.")
  280.      )
  281.  
  282.  
  283.      (set #pgp-bin-prompt (cat
  284.         "Please choose where to install the " @app-name
  285.             " program binary.")
  286.          )
  287.      (set #pgp-bin-help (cat
  288.         "This is where the " @app-name " binary will"
  289.                 " be installed. Ideally, it should be somewhere"
  290.         " in your shell path.")
  291.      )
  292.  
  293.      (set #pgp-ag-prompt (cat
  294.         "Please choose where to install the " @app-name
  295.         " AmigaGuide® documentation.")
  296.      )
  297.      (set #pgp-ag-help (cat
  298.         "This should be where you normally keep your"
  299.         " AmigaGuide® help files and documentation.\n\n"
  300.         "AmigaGuide® is the Amiga hypertext help system.")
  301.      )
  302.  
  303.      (set #pgp-path-prompt (cat
  304.         "Please choose where to install the " @app-name
  305.         " configuration and support files.")
  306.      )
  307.          (set #pgp-path-help (cat
  308.         "This is where files necessary to " @app-name
  309.                 " will be installed. These files include the"
  310.                 " configuration file, language files, internal"
  311.         " help, as well as the PGP keyrings.\n\n"
  312.         "These files do not have to be located in the"
  313.         " same place as the binary.")
  314.      )
  315.  
  316.      (set #config-backup-prompt (cat
  317.         "Do you wish to overwrite your current PGP configuration"
  318.         " with the new one from this archive? (Not"
  319.         " recommended.)")
  320.      )
  321.          (set #config-backup-help (cat
  322.                 "In most cases, this is not necessary. The configuration"
  323.         " file has changed very little (if at all) from previous"
  324.                 " versions of PGP.\nI would, however, recommend that you"
  325.         " read the the PGP documentation for any information on"
  326.         " important configuration file changes.")
  327.      )
  328.      (set #config-backup-choices1 (cat
  329.                 #no ".")
  330.      )
  331.          (set #config-backup-choices2 (cat
  332.                 #yes ".")
  333.      )
  334.          (set #config-backup-choices3 (cat
  335.         #yes ", but backup my old configuration first!")
  336.      )
  337.  
  338.  
  339.      (set #working-pgp-bin (cat
  340.         "Installing " @app-name " binary.")
  341.      )
  342.          (set #working-pgp-etc (cat
  343.         "Installing " @app-name " support files.")
  344.      )
  345.      (set #working-pgp-etc-help (cat
  346.         "Installing " @app-name " help files.")
  347.          )
  348.      (set #working-config-backup (cat
  349.         "Backing up old configuration.")
  350.      )
  351.      (set #working-ag (cat
  352.         "Installing " @app-name " AmigaGuide® hypertext"
  353.         " help files.")
  354.      )
  355.  
  356.      (set #asksumming-prompt (cat
  357.         "Should the data integrity of " @app-name
  358.         " be checked before attempting to install?\n\n"
  359.         "(This is recommended.)")
  360.          )
  361.      (set #asksumming-help (cat
  362.         "This will calculate an MD5SUM checksum for the "
  363.         @app-name " archive and compare it with known values.\n\n"
  364.         "This will take a few moments,"
  365.         " depending on the speed of your system.")
  366.      )
  367.      (set #pgpsumming (cat
  368.         "Checking the integrity of " @app-name "."
  369.         "\n\nThis may take a few moments, depending on the"
  370.         " speed of your system.")
  371.      )
  372.      (set #badpgpmsg (cat
  373.         "WARING: This version of " @app-name " is"
  374.                 " incorrect, damaged, or has been tampered with. Please check the"
  375.         " archive and the archive source carefully. If you"
  376.         " suspect the archive has been modified please contact"
  377.         " Peter Simons <simons@peti.GUN.de> immediately!")
  378.      )
  379.  
  380.      (set #working-env-prompt (cat
  381.         "Creating enviroment variable for " @app-name
  382.         ".")
  383.      )
  384.      (set #working-env-help (cat
  385.         "This will create the necessary enviroment variables"
  386.         " for the proper operation of " @app-name ".")
  387.      )
  388.  
  389.      (set #bad-os (cat
  390.         "PGP-Install requires OS 2.04 or newer.\n\n"
  391.         "Time to upgrade your system!")
  392.      )
  393.  
  394.      (set #ask-view-prompt (cat
  395.         "Do you wish to read the ReadMe.Amiga file for "
  396.         @app-name " now?\n\n"
  397.                 "(This is recommended.)")
  398.      )
  399.          (set #ask-view-help (cat
  400.         "This will display some important information you should"
  401.         " know about " @app-name ". It is a good idea to read"
  402.         " this before attempting to use the program.")
  403.      )
  404.      (set #working-advancedok (cat
  405.         "Install advanced version?")
  406.      )
  407.      (set #askadvancedok-prompt (cat
  408.         "An advanced processor has been detected. Please confirm the"
  409.         " version of " @app-name " that you wish to install.")
  410.      )
  411.      (set #askadvancedok-help (cat
  412.         "If you have an advanced processor (68020+) installed in your Amiga"
  413.         " you will gain performance benefits by installing the advanced"
  414.         " version of " @app-name ".\n\nPlease note that Installer may"
  415.         " not know about the 68060 processor, you should manually select the 68020+"
  416.         " option if you have a 68060.")
  417.      )
  418.  
  419.     )
  420.  
  421.     ; Complain that English wasn't chosen as the language
  422.     (
  423.      (abort (cat "At present the PGP-Installer currently only"
  424.                  " supports English. In the future there will"
  425.                      " hopefully be more support for other languages."
  426.                      " My apologies for the inconvenience.\n\n"
  427.                      "If you would like to help support a version of"
  428.                      " the PGP-Installer in your language, please"
  429.                      " contact me (Jacob Ellis <jellis@nah.oau.org>)"
  430.                      " or Peter Simons <simons@peti.GUN.de> for more"
  431.                      " information. Thank you!")
  432.      )
  433.     )
  434. ) ;endif not-english
  435.  
  436.  
  437.  
  438. ; ***********************************************************
  439. ; * start installer
  440. ; ***********************************************************
  441.  
  442. (if (< osver 37) ; Make sure OS 2.04 is running
  443.     (abort #bad-os) ; abort if not OS 2.04
  444. )
  445.  
  446. (welcome) ; start the main installer procedure
  447.  
  448.  
  449. (complete 5)
  450. (if (> 2 @user-level) ; ask if expert user wishes to check PGP binary
  451.     (
  452.         (set choice 1) ; novice and average get this by default
  453.     )
  454.     (
  455.         (set choice (askbool (prompt #asksumming-prompt) (help #asksumming-help) (choices #yes #no) (default 1)))
  456.     )
  457. )
  458. (complete 10)
  459. (if (= choice 1) ; yes, a check is wanted
  460.         (
  461.         (working #pgpsumming)
  462. ;        (if (<> newpgpbinsum (getsum(newpgpbin))) ; checking
  463. ;            (abort #badpgpmsg) ; abort if not what was expected
  464.         (if (run "contrib/md5sum/md5sum -c Readme.Amiga" (safe))
  465.             (
  466.                 (abort #badpgpmsg)
  467.             )
  468.         )
  469.     )
  470. )
  471.  
  472. (set choice 1)
  473. (if (AND (< 1 @user-level advancedcpu) ; Ask expert if CPU choice is correct
  474.     (
  475.         (set choice (askchoice (prompt #askadvancedok-prompt) (help #askadvancedok-help) (choices "68020+" "68000") (default 0))))
  476.     )
  477. )
  478. (if (= choice 0)
  479.     (
  480.         (set newpgpbin newpgpbin020)
  481.         (set newpgpbinsum newpgpbinsum020)
  482.         (set newpgpbinsize newpgpbinsize020)
  483.     )
  484.     (
  485.         (set newpgpbin newpgpbin000)
  486.         (set newpgpbinsum newpgpbinsum000)
  487.         (set newpgpbinsize newpgpbinsize000)
  488.     )
  489. )
  490.  
  491.  
  492.  
  493. ; ***********************************************************
  494. ; * Discover if PGP is already installed.
  495. ; * And if so, find where the binary and support files are
  496. ; ***********************************************************
  497.  
  498. (complete 13)
  499.  
  500. (if (exists "ENV:PGPPATH")
  501.     (
  502.                 (set pgppath (getenv "PGPPATH"))
  503.         (if (run "C:Which PGP NoRes" (safe))
  504.             (
  505.                 (set pgpbinpath  (tackon @default-dest "PGP"))
  506.             )
  507.             (
  508.                 (run "setenv pgpinstall.tmp `C:Which PGP NoRes`" (safe))
  509.                 (set pgpbinpath (getenv "pgpinstall.tmp"))
  510.                         (set pgpbinpath (pathonly pgpbinpath))
  511.                 (delete "ENV:pgpinstall.tmp" (safe))
  512.             )
  513.         )
  514.         (set pgpexists TRUE)
  515.     )
  516.     (
  517.                 (set pgpexists FALSE)
  518.                 (set pgpbinpath (tackon @default-dest "PGP"))
  519.                 (set pgppath (tackon @default-dest "PGP"))
  520.     )
  521. )
  522.  
  523.  
  524.  
  525. (complete 15)
  526. ; ***********************************************************
  527. ; * Discover if and where AmigaGuide files are kept
  528. ; ***********************************************************
  529.  
  530. (if (exists "libs:amigaguide.library") ; see if AmigaGuide lib exists
  531.  
  532.     ; AmigaGuide exists
  533.         (
  534.      (set agexists TRUE)
  535.      (if (exists "ENV:AmigaGuide/Path")
  536.         ( ; AmigaGuide user that read the manual
  537.                     (set agpath (getenv "AmigaGuide/Path")) ; my personal favorite
  538.  
  539.             ; This is a little Installer program that will parse an ENV:
  540.             ; variable and return the first item in the variable
  541.  
  542.             (set maxn (strlen agpath))
  543.             (set n 0)
  544.             (set inquote FALSE)
  545.             (set agtmp "")
  546.             (set afterlead FALSE)
  547.  
  548.             (while (<= n maxn)
  549.                 (
  550.                     (set skipchar FALSE)    ; quotes can't be part of the path
  551.                                 ; so they must not be copied
  552.  
  553.                     (set char (substr agpath n 1)) ; get character
  554.  
  555.                     (if (AND (= " " char) (NOT afterlead)) ; skip any leading space
  556.                         (
  557.                                         (set skipchar TRUE)
  558.                                     )
  559.                     )
  560.  
  561.                     (if (AND (= char "\"") inquote) ; end of quote?
  562.                         (
  563.                             (set n maxn)        ; end quote
  564.                             (set skipchar TRUE) ; skip this char
  565.                         )
  566.                     )
  567.  
  568.                     (if (AND (= char "\"") (NOT inquote)) ; start of quote?
  569.                         (
  570.                             (set inquote TRUE)  ; start quote
  571.                             (set skipchar TRUE) ; skip this char
  572.                         )
  573.                             )
  574.  
  575.                             (if (AND afterlead (AND (NOT inquote) (OR (= char " ") (= char "\0")))) ; check if space or NULL and not in a quote
  576.                         (
  577.                             (set n maxn) ; found end of a path, get out
  578.                         )
  579.                             )
  580.  
  581.                             (if (NOT skipchar)
  582.                                     (
  583.                             (set agtmp (cat agtmp char))
  584.                             (set afterlead TRUE)
  585.                         )
  586.                     )
  587.  
  588.                     (set n (+ n 1))
  589.                 )
  590.             )
  591.  
  592.             (set agpath agtmp)
  593.         )
  594.         (
  595.                         (if (exists (tackon "HELP:" @language))
  596.                 ( ; OS2.1 or later
  597.                     (set agpath (tackon "HELP:" @language))
  598.                 )
  599.                 ( ; OS2.04 (AmigaGuide not included)
  600.                     (set agpath "S:")
  601.                 )
  602.                         )
  603.         )
  604.      )
  605.     ) ;end amigaguide exists
  606.  
  607.     ; AmigaGuide does not exist, AmigaGuide files will be placed
  608.     ; in the default destination
  609.     (
  610.      (set agexists FALSE)
  611.     )
  612. )
  613. (complete 18)
  614.  
  615.  
  616.  
  617. ; ***********************************************************
  618. ; * Ask where to install various PGP stuff
  619. ; ***********************************************************
  620.  
  621. ; make sure user really wants to install PGP binary here
  622. (set pgpbinpath (askdir (prompt #pgp-bin-prompt) (help #pgp-bin-help) (default pgpbinpath) (newpath)))
  623.  
  624. (complete 20)
  625. ; make sure user really wants to install PGP support here
  626. (set pgppath (askdir (prompt #pgp-path-prompt) (help #pgp-path-help) (default pgppath) (newpath)))
  627.  
  628. (complete 23)
  629. ; See if PGP might really be installed even though no ENV: variable
  630. ; This is necessary for the config stuff below
  631. (if (exists (tackon pgppath pgpconfig))
  632.     (
  633.         (set pgpexists TRUE)  ; PGP really does exist at where the
  634.     )                             ; users wants to install
  635.     (
  636.         (set pgpexists FALSE) ; PGP does NOT exist where the user
  637.     )                             ; wants to install
  638.                                       ; But it might really exist someplace else
  639. )
  640.  
  641.  
  642. (set @default-dest pgppath) ; when in doubt - the default destination
  643.  
  644. (complete 25)
  645. ; Ask where to install AmigaGuide files
  646. (if agexists
  647.     (       ; make sure user really wants to install PGP AmigaGuide files here
  648.         (set agpath (askdir (prompt #pgp-ag-prompt) (help #pgp-ag-help) (default agpath) (newpath)))
  649.     )
  650.     (       ; User does not have AmigaGuide, but still needs the files for documentation
  651.         (set agpath pgppath)
  652.     )
  653. )
  654.  
  655.  
  656.  
  657. ; ***********************************************************
  658. ; * Discover if user is trying to install an older PGP
  659. ; ***********************************************************
  660.  
  661. (complete 27)
  662. (if pgpexists
  663.     (
  664.         (set oldpgpbin (tackon pgpbinpath "PGP"))
  665.         (if (exists oldpgpbin)
  666.             (
  667.                 (if (= (getsize oldpgpbin) newpgpbinsize)
  668.                     (
  669.                         (if(askbool (prompt #already-installed) (help #already-installed-help) (default 0) (choices #yes #no))
  670.                                   (set donothing TRUE)
  671.                             (abort #already-installed-abort)
  672.                                  )
  673.                             )
  674.                                     (
  675.                          (if (earlier newpgpbin oldpgpbin)
  676.                             (
  677.                                 (if(askbool (prompt #old-installed) (help #old-installed-help) (default 0) (choices #yes #no))
  678.                                           (set donothing TRUE)
  679.                                     (abort #old-installed-abort)
  680.                                          )
  681.                                     )
  682.                              )
  683.                     )
  684.                 )
  685.             )
  686.         )
  687.     )
  688. )
  689.  
  690.  
  691.  
  692. ; ***********************************************************
  693. ; * Install PGP binary
  694. ; ***********************************************************
  695.  
  696. (complete 30)
  697.  
  698. (copyfiles (prompt #working-pgp-bin) (help (cat #pgp-bin-help "\n\n" @copyfiles-help)) (source newpgpbin) (dest pgpbinpath) (newname "PGP") (files) (confirm))
  699.  
  700. ; ***********************************************************
  701. ; * Install PGP support files
  702. ; ***********************************************************
  703.  
  704. ; for novice user, do not install new configuration file unless
  705. ;  this is a new installation.
  706. ; for intermediate or expert, offer to backup old configuration first
  707.  
  708. (if pgpexists
  709.     (
  710.         (complete 35)
  711.         (set config-choice (askchoice (prompt #config-backup-prompt) (help #config-backup-help) (choices #config-backup-choices1 #config-backup-choices2 #config-backup-choices3)))
  712.                 (if (= 2 config-choice)
  713.             (       ; backup old configuration
  714.                 (complete 40)
  715.                                 (set sourceconfig (cat (tackon pgppath pgpconfig)))
  716.                 (set destconfig (cat pgpconfig ".bak"))
  717.                 (copyfiles (prompt #working-config-backup) (help (cat #working-config-backup "\n\n" @copyfiles-help)) (source sourceconfig) (dest pgppath) (newname destconfig) (files) (confirm))
  718.                         )
  719.         )
  720.         (if (< 0 config-choice)
  721.                         (       ; user wnats new Config file
  722.                 (complete 45)
  723.                 (copyfiles (prompt #working-pgp-etc) (help (cat #working-pgp-etc "\n\n" @copyfiles-help)) (source newpgpconfig) (dest pgppath) (files) (confirm))
  724.             )
  725.         )
  726.     )
  727.     (       ; new installation, so new Config file needed (redundant!)
  728.         (complete 40)
  729.         (copyfiles (prompt #working-pgp-etc) (help (cat #working-pgp-etc "\n\n" @copyfiles-help)) (source newpgpconfig) (dest pgppath) (files) (confirm))
  730.     )
  731. )
  732.  
  733. ; install rest of support files
  734.  
  735. (complete 45)
  736.  
  737. (copyfiles (prompt #working-pgp-etc) (help (cat #working-pgp-etc "\n\n" @copyfiles-help)) (choices "keys.asc" "language.txt") (dest pgppath) (source "bin") (files) (confirm))
  738. (copyfiles (prompt #working-pgp-etc-help) (help (cat #working-pgp-etc-help "\n\n" @copyfiles-help)) (pattern "#?.hlp") (dest pgppath) (source "bin") (files) (confirm))
  739.  
  740.  
  741. ; ***********************************************************
  742. ; * Install PGP AmigaGuide files
  743. ; ***********************************************************
  744.  
  745. ; For non-AmigaGuide system, AmigaGuide files will be copied with
  746. ; the rest of the PGP support files.
  747. ; For AmigaGuide system, AmigaGuide files will be copied to
  748. ; the following (in order):
  749. ;    1. User-Specified location
  750. ;     2. ENV:AmigaGuide/Path setting
  751. ;    3. HELP:(language) where language is the language in use
  752. ;    4. S: for OS2.04 systems that added AmigaGuide and haven't
  753. ;             bothered to set a special place for AmigaGuide files
  754.  
  755. (complete 75)
  756.  
  757. (copyfiles (prompt #working-ag) (help (cat #working-ag "\n\n" @copyfiles-help)) (source "doc") (dest agpath) (choices "PGPDoc1.guide" "PGPDoc2.guide" "PGPNutshell.guide") (files) (confirm))
  758.  
  759.  
  760.  
  761. ; ***********************************************************
  762. ; * Set up ENV: and ENVARC: to point to where PGP was installed
  763. ; ***********************************************************
  764.  
  765. (if (NOT pgpexists) ; Don't do anything if this is an upgrade
  766.     (       ;set ENV:
  767.         (complete 85)
  768.         (textfile (prompt #working-env-prompt) (help #working-env-help) (dest "ENV:PGPPATH") (append (expandpath pgppath)) (confirm))
  769.             ;set ENVARC:
  770.         (complete 90)
  771.         (textfile (prompt #working-env-prompt) (help #working-env-help) (dest "ENVARC:PGPPATH") (append (expandpath pgppath)) (confirm))
  772.     )
  773. )
  774.  
  775.  
  776.  
  777. ; ***********************************************************
  778. ; * Installation basically complete, just show the readme now
  779. ; ***********************************************************
  780.  
  781. ; View readme with:
  782. ;    1. ENV:PAGER
  783. ;    2. More if not OS 3.x
  784. ;    3. Multiview if OS 3.x
  785.  
  786. ; NOTE: This has problems when run from workbench, which is
  787. ;       why full paths are given below.
  788.  
  789. (if (exists "ENV:PAGER")
  790.     (
  791.         (set pager (getenv "PAGER"))
  792.     )
  793.         (
  794.                 (if (< osver 39)
  795.             (
  796.                                 (set pager "SYS:Utilities/More")
  797.             )
  798.             (
  799.                 (set pager "SYS:Utilities/Multiview")
  800.                 )
  801.         )
  802.     )
  803. )
  804.  
  805.  
  806. (complete 95) ; 95% done
  807.  
  808.  
  809. (if (> 2 @user-level) ; ask expert if they wish NOT to view the readme
  810.     (
  811.         (set choice 1) ; default yes
  812.     )
  813.     (
  814.         (set choice (askbool (prompt #ask-view-prompt) (help #ask-view-help) (choices #yes #no) (default 1)))
  815.     )
  816. )
  817. (if (= choice 1) ; yes, they want to read it
  818.         (run (cat pager " ReadMe.Amiga") (safe))
  819. )
  820.  
  821. (complete 100) ; 100% done
  822.  
  823. ; The end! Phew!
  824.